package com.honey.solr.daosupport.method;

import com.honey.compilation.java.Method;
import com.honey.compilation.java.Parameter;
import com.honey.compilation.java.TryCatchBlock;
import com.honey.core.types.ExceptionFullyQualifiedJavaType;
import com.honey.generator.java.AbstractClassName;
import com.honey.solr.SolrConstant;

public class Query2Method extends AbstractClassName {
	
	
	public Method createMethod(){
		Method answer = new Method("query");
		Parameter parameter = new Parameter(SolrConstant.SOLR_PARAMS,"params");
		answer.addParameter(parameter) ;
		parameter = new Parameter(SolrConstant.SOLR_REQUEST_METHOD,"method");
		answer.addParameter(parameter) ;
		answer.setReturnType(SolrConstant.QUERY_RESPONSE);
		answer.addException(SolrConstant.SOLR_SERVER_EXCEPTION);
		answer.addBodyLine("QueryResponse answer = null ");
		answer.addBodyLine("answer = "+SolrConstant.SOLR_SERVER_FIELD_NAME+".query(params, method)") ;
		answer.addBodyLine("return answer") ;
		return answer;
	}
}
